package com.manage.platform.config;

import com.manage.platform.service.impl.RoleMenuServiceImpl;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

/**
 * @author lk
 * 启动任务
 */
@AllArgsConstructor
@Slf4j
@Component
public class InitRunner implements ApplicationRunner {


    private final RoleMenuServiceImpl roleMenuServiceImpl;

    @Override
    public void run(ApplicationArguments args) throws Exception {
        try {
            // 本方法不要加事务，避免initSystem异常影响菜单初始化
            //初始化菜单
            //menuServiceImpl.initMenu();
            //初始化管理员用户菜单权限
            //roleMenuServiceImpl.initRoleMenu();
        } catch (Exception e) {
            log.error("菜单权限初始化失败", e);
        }
    }

}
